package com.bmit.ava.service;

import com.bmit.ava.mapper.AvaCodeMapper;
import com.bmit.ava.model.AvaCodeWithBLOBs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CodeService {
    @Autowired
    private AvaCodeMapper avaCodeMapper;

    public boolean createNewCode(AvaCodeWithBLOBs avaCodeWithBLOBs) {
        boolean flag = false;
        try {
            flag = avaCodeMapper.insert(avaCodeWithBLOBs) > 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }

    public AvaCodeWithBLOBs selectOneById(int id) {
        return avaCodeMapper.selectByPrimaryKey(id);
    }
}
